
//管理员登录验证
$(function (){
    listen_login_btn();
});

//监听登录按钮
function listen_login_btn()
{
    $('#admin-login-btn').click(function (){
        let adminName = $('#name').val();
        let adminPassword = $('#password').val();
        $.ajax({
            url: "/admin/login/"+ adminName + "/" + adminPassword,
            type: "GET",
            success: function (result){
                if(result.extend.login_admin !== null)
                {
                    alert("欢迎您！"+ result.extend.login_admin.name);
                    window.location.href = './mainMenu.html';
                }
                else
                {
                    alert("用户名或密码错误!");
                }
            }
        });
    }) ;
}